﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace PSE.Communication.Fix.Common
{
    public class FixConfigurationSection : ConfigurationSection
    {
        [ConfigurationProperty("dataDictionary", IsRequired = true)]
        public string DataDictionary
        {
            get { return FixConfigurationManager.GetFullPath((string)this["dataDictionary"]); }            
        }

        [ConfigurationProperty("fixSessions", IsRequired = false)]
        [ConfigurationCollection(typeof(FixSessionConfigurationElement), AddItemName = "session")]
        public ConfigurationCollection<FixSessionConfigurationElement> FixSessions
        {
            get
            {
                return (ConfigurationCollection<FixSessionConfigurationElement>)this["fixSessions"];
            }
        }

        [ConfigurationProperty("fixmlSessions", IsRequired = false)]
        [ConfigurationCollection(typeof(FixmlSessionConfigurationElement), AddItemName = "session")]
        public ConfigurationCollection<FixmlSessionConfigurationElement> FixmlSessions
        {
            get
            {
                return (ConfigurationCollection<FixmlSessionConfigurationElement>)this["fixmlSessions"];
            }
        }

        [ConfigurationProperty("providers", IsRequired = false)]
        [ConfigurationCollection(typeof(ProviderConfigurationElement), AddItemName = "provider", CollectionType = ConfigurationElementCollectionType.BasicMap)]
        public ConfigurationCollection<ProviderConfigurationElement> Providers
        {
            get
            {
                return (ConfigurationCollection<ProviderConfigurationElement>)this["providers"];
            }
        }
    }
}
